Skip to content

Refactor qannotate to support multi-mode execution with per-mode database assignment#399

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/refactor-qannotate-multiple-modes
Draft

Refactor qannotate to support multi-mode execution with per-mode database assignment#399
Copilot wants to merge 3 commits intomasterfrom
copilot/refactor-qannotate-multiple-modes

Conversation

Copy link

Copilot AI commented Feb 25, 2026

Description

qannotate previously enforced a single -mode per run, requiring repeated load/annotate/write cycles for multi-step annotation workflows. This change allows multiple modes to be specified and executed sequentially in one CLI invocation while preserving existing single-mode behavior.

  • CLI parsing: multi-mode support

    • Options captures all provided --mode values (getModes()), while retaining getMode() (first mode) for compatibility.
    • Mode-specific argument registration (eg. -d, --config, --summaryFile, --test/--control) is enabled when any selected mode requires it.
  • Execution flow: chained per-mode runs

    • Main now branches on options.getModes():
      • single mode: unchanged path
      • multiple modes: execute modes in order, piping intermediate output through temp VCFs and writing final output once
    • Added explicit guard to reject multi-mode runs containing vcf2maf/vcf2maftmp in mixed pipelines.
  • Per-mode database assignment in multi-mode runs

    • Multi-mode execution now extracts all -d/--database arguments once and assigns them in order to only the modes that require a database.
    • Modes that do not require a database do not consume a -d.
    • Supports -d value, -d=value, and --database=value forms when collecting database arguments.
  • Focused tests

    • Added OptionsTest.multipleModes() to verify ordered multi-mode parsing and backward-compatible primary mode behavior.
    • Added/updated MainTest coverage for:
      • per-mode argument rewriting with explicit per-mode database inputs
      • ordered extraction of database arguments
// supported: ordered modes, ordered per-mode databases for database-requiring modes
qannotate --mode dbsnp --mode confidence --mode germline -i in.vcf -o out.vcf -d dbsnp.vcf -d germline.vcf

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Targeted qannotate unit tests were run for multi-mode parsing, per-mode argument rewriting, and database argument handling.

  • au.edu.qimr.qannotate.OptionsTest
  • au.edu.qimr.qannotate.MainTest

Are WDL Updates Required?

No WDL updates required; change is isolated to qannotate CLI option parsing/execution flow.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: holmeso <7066552+holmeso@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor qannotate to support multiple modes simultaneously Refactor qannotate to support multi-mode execution in a single invocation Feb 25, 2026
Copilot AI requested a review from holmeso February 25, 2026 03:06
@holmeso
Copy link
Contributor

holmeso commented Feb 25, 2026

@copilot will the order of modes that is provided by the user be maintained when running them?

Copy link
Author

Copilot AI commented Feb 25, 2026

@copilot will the order of modes that is provided by the user be maintained when running them?

Yes — mode order is maintained. Options stores modes in the same order they are supplied on the CLI (options.valuesOf("mode")), and Main.runMultipleModes(...) iterates that list in index order, executing each mode sequentially in that same order.

@holmeso
Copy link
Contributor

holmeso commented Feb 25, 2026

@copilot each mode will potentially have its own -d database file that will be required. Not all modes need this

Co-authored-by: holmeso <7066552+holmeso@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 25, 2026

@copilot each mode will potentially have its own -d database file that will be required. Not all modes need this

Updated in 52dc3ad: multi-mode execution now extracts all -d/--database args once and assigns them per mode in order, only to modes that use a database. This allows different database files across modes (with non-database modes not consuming a -d).

Copilot AI changed the title Refactor qannotate to support multi-mode execution in a single invocation Refactor qannotate to support multi-mode execution with per-mode database assignment Feb 25, 2026
newellf
newellf previously approved these changes Feb 26, 2026
@newellf newellf dismissed their stale review February 26, 2026 00:46

Realised was draft not for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants